import VueRouter from 'vue-router'
import Vue from 'vue'
// import { Alert } from 'element-ui';

// 安装路由插件
Vue.use(VueRouter)

// 创建vuerouter对象
const routes = [
  // 默认路径
  {
    path: '',
    redirect: '/pc'
  },
  {
    path:'/pc',
    name:"PC",
    component:resolve => require(['../PC.vue'], resolve)
  },
  {
    path:'/mobile',
    name:"mobile",
    component:resolve => require(['../MOBILE.vue'], resolve)
  },
]

// router.beforeEach((to, from, next) => {
//   if (navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|AndroidMobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOSSymbian|Windows Phone)/i)) {
//     next('/mobile');
//   } else {
//     next("/pc");
//   }
// });



const router = new VueRouter ({
  routes
})

export default router